package logic;

import java.util.Date;
import data.IUserDAO;
import data.JDBCUserDAO;

public class User {
	
	private String id;
	private String nick;
	private String mail;
	private String pass;
	private String genre;
	private Date birthDate;
	private Date regDate;
	private String name;
	private String surname;
	private String country;
	private String continent;
	private String city;
	private Integer postalCode;
	private String address;
	private String dni;
	private boolean isVolunteer;
	private Integer donorVotes;
	private Integer buyerVotes;
	private float moneyRaised;
	private int amountDonate;
	private int amountDonateBuyed;
	private IUserDAO udao = new JDBCUserDAO();
	
	
	public User(String id, String nick, String mail, String pass,
			String genre, Date birthDate, Date regDate, String name,
			String surname, String country, String city, Integer postalCode,
			String address, String dni,
			boolean isVolunteer, Integer donorVotes, Integer buyerVotes) {
		super();
		this.id = id;
		this.nick = nick;
		this.mail = mail;
		this.pass = pass;
		this.genre = genre;
		this.birthDate = birthDate;
		this.regDate = regDate;
		this.name = name;
		this.surname = surname;
		this.country = country;
		this.city = city;
		this.postalCode = postalCode;
		this.address = address;
		this.dni = dni;
		this.isVolunteer = isVolunteer;
		this.donorVotes = donorVotes;
		this.buyerVotes = buyerVotes;

	}
	
	public User(){
		super();
	}
	
	public String selectIDUserByNick(String username){
		String id = udao.selectUserByUsername(username);
		return id;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getNick() {
		return nick;
	}
	public void setNick(String nick) {
		this.nick = nick;
	}
	public String getMail() {
		return mail;
	}
	public void setMail(String mail) {
		this.mail = mail;
	}
	public String getPass() {
		return pass;
	}
	public void setPass(String pass) {
		this.pass = pass;
	}
	public String getGenre() {
		return genre;
	}
	public void setGenre(String genre) {
		this.genre = genre;
	}
	public Date getBirthDate() {
		return birthDate;
	}
	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}
	public Date getRegDate() {
		return regDate;
	}
	public void setRegDate(Date regDate) {
		this.regDate = regDate;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSurname() {
		return surname;
	}
	public void setSurname(String surname) {
		this.surname = surname;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getContinent() {
		return continent;
	}
	public void setContinent(String continent) {
		this.continent = continent;
	}
	
	
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public Integer getPostalCode() {
		return postalCode;
	}
	public void setPostalCode(Integer postalCode) {
		this.postalCode = postalCode;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getDni() {
		return dni;
	}
	public void setDni(String dni) {
		this.dni = dni;
	}
	public boolean isVolunteer() {
		return isVolunteer;
	}
	public void setVolunteer(boolean isVolunteer) {
		this.isVolunteer = isVolunteer;
	}
	public Integer getDonorVotes() {
		return donorVotes;
	}
	public void setDonorVotes(Integer donorVotes) {
		this.donorVotes = donorVotes;
	}
	public Integer getBuyerVotes() {
		return buyerVotes;
	}
	public void setBuyerVotes(Integer buyerVotes) {
		this.buyerVotes = buyerVotes;
	}

	/**Método Nando
	 *  Usar votosDonante, votoscomprador y votos como voluntario. 
	 * Mirar la cantidad total de dinero donado.
	 * Mirar la tasa de objetos donados/vendidos
	 * Mirar la prioridad del destino del objeto
	 * Tasa por encima de 0,8 entra como avitos, entre 0,8 y 0,1 entra en revision
	 * y por debajo el objeto es automaticamente rechazado.
	 */
	public int calculateGlobalRatio(){
		int globalRatio=0;
		//Set<E> s = (Set)Admin.this.getCriterios();
		return globalRatio;
	}
	
	public float getMoneyRaised() {
		return this.moneyRaised;
	}
	
	
	public void setMoneyRaised(float moneyRaised) {
		this.moneyRaised = moneyRaised;
	}
	public void setAmountDonate(int amountDonate) {
		this.amountDonate = amountDonate;
	}
	public int getAmountDonate() {
		return this.amountDonate;
	}

	public void setAmountDonateBuyed(int amountDonateBuyed) {
		this.amountDonateBuyed = amountDonateBuyed;
	}
	public int getAmountDonateBuyed() {
		return this.amountDonateBuyed;
	}

}

